package com.adcage.ojudgebackendjudgeservice.judge.codeSandbox;

import com.adcage.ojudgebackendmodel.codesandbox.ExecuteCodeRequest;
import com.adcage.ojudgebackendmodel.codesandbox.ExecuteCodeResponse;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@AllArgsConstructor
public class CodeSandboxProxy implements CodeSandbox {

    private final CodeSandbox codeSandbox;

    @Override
    public ExecuteCodeResponse executeCode(ExecuteCodeRequest request) {
        //使用String.valueOf()方法转换字符串,而不使用request.toString()方法,避免null值调用错误
        log.info("代码沙箱请求信息" + request);
        ExecuteCodeResponse response = codeSandbox.executeCode(request);
        log.info("代码沙箱响应信息" + response);
        return response;
    }
}
